import tkinter,qrcode,time
import tkinter.messagebox
window =tkinter.Tk()
window.title('二维码生成器')
window.geometry('500x200')
def Initialization():
    name='NEW QRCODE'
    content='NO TYPE'
    format='.png'

def Get_name():
    name=typy2.get()
    return name

def Get_content():
  content=typy1.get()
  return content

def Get_format():
  format=typy3.get()
  if format!='.png':
      if format!= '.jpg':
          format='.png'
  return format

def generate():
    content=Get_content()
    name=Get_name()
    format=Get_format()
    QRcode_name=str(name)+str(format)
    img=qrcode.make(content)
    img.save(QRcode_name)
    OK()
def OK():
    tkinter.messagebox.showinfo('二维码生成器', '二维码生成成功！')

def Copyright():
    tkinter.messagebox.showinfo('二维码生成器', '版权归恩凡所有\n版本：0.0.1')

#初始化
Initialization()
new1=tkinter.Label(window, text='请输入二维码内容')
new1.pack()

typy1=tkinter.Entry(window, show=None, font=('Arial', 14))
typy1.pack()

new2=tkinter.Label(window, text='请输入二维码名字')
new2.pack()

typy2=tkinter.Entry(window, show=None, font=('Arial', 14))
typy2.pack()

new3=tkinter.Label(window, text='请输入二维码格式（如‘.png’‘.jpg’）')
new3.pack()

typy3=tkinter.Entry(window, show=None, font=('Arial', 14))
typy3.pack()

button1=tkinter.Button(window, text='生成二维码', command=generate)
button1.pack()

button2=tkinter.Button(window, text='---*版权*---', command=Copyright)
button2.pack()
window.mainloop()